/**
 * 
 */
package com.cea.papyrus.diagram.component.helper;

import com.cea.papyrus.core.IPapyrusUIConstants;
import com.cea.papyrus.diagram.classdiagram.helper.ClassDiagramModelerHelper;
import com.cea.papyrus.diagram.classdiagram.helper.EdgeAbstractionHelper;
import com.cea.papyrus.diagram.classdiagram.helper.EdgeAssociationHelper;
import com.cea.papyrus.diagram.classdiagram.helper.EdgeGeneralizationHelper;
import com.cea.papyrus.diagram.classdiagram.helper.EdgeInterfaceRealizationHelper;
import com.cea.papyrus.diagram.classdiagram.helper.EdgeRealizationHelper;
import com.cea.papyrus.diagram.classdiagram.helper.EdgeUsageHelper;
import com.cea.papyrus.diagram.classdiagram.helper.NodeClassHelper;
import com.cea.papyrus.diagram.classdiagram.helper.NodePropertyHelper;
import com.cea.papyrus.diagram.classdiagram.helper.NodeSlotHelper;

//import com.cea.papyrus.diagram.deployment.helper.NodeArtifactHelper;
//import com.cea.papyrus.diagram.component.helper.NodeArtifactHelper;
//import com.cea.papyrus.diagram.composite.helper.NodePortHelper;
/**
 * Defines the management of component diagrams
 * 
 * @author al090761
 *
 */

public class ComponentDiagramModelerHelper extends ClassDiagramModelerHelper {
	/**
	 * 
	 */
	private static ComponentDiagramModelerHelper EINSTANCE;

	/**
	 * set of uml elements that can be created in this diagram.
	 */
	protected final Class<?> elementTypes[] = {
			org.eclipse.uml2.uml.Artifact.class,
			org.eclipse.uml2.uml.Component.class,
			org.eclipse.uml2.uml.Interface.class,
			org.eclipse.uml2.uml.Package.class,
			org.eclipse.uml2.uml.Port.class,
			org.eclipse.uml2.uml.Class.class,
			org.eclipse.uml2.uml.Property.class,
			org.eclipse.uml2.uml.Slot.class,
			org.eclipse.uml2.uml.Comment.class,
			org.eclipse.uml2.uml.Constraint.class,
			org.eclipse.uml2.uml.InstanceSpecification.class,
			
			// edges
			org.eclipse.uml2.uml.Dependency.class,
			org.eclipse.uml2.uml.Generalization.class,
			org.eclipse.uml2.uml.Association.class,
			org.eclipse.uml2.uml.Connector.class,
			org.eclipse.uml2.uml.Realization.class,
			org.eclipse.uml2.uml.Usage.class,
			org.eclipse.uml2.uml.InterfaceRealization.class,
			com.cea.papyrus.core.pseudoelement.GraphicalLink.class,
			com.cea.papyrus.diagram.composite.pseudoelement.RoleBinding.class,
			org.eclipse.uml2.uml.Abstraction.class
//			InstanceSpecificationLink.class,
	};

	/**
	 * set of factories that correspond to the precedent uml types.
	 */
	protected final com.cea.papyrus.core.helper.IGraphElementHelper nodeFactory[] = {
			new NodeArtifactHelper(),
			new NodeComponentHelper(),
			new NodeInterfaceHelper(),
			new NodePackageHelper(),
			new NodePortHelper(),
			new NodeClassHelper(),
			new NodePropertyHelper(),
			new NodeSlotHelper(),
			new com.cea.papyrus.diagram.classdiagram.helper.NodeCommentHelper(),
			new com.cea.papyrus.diagram.classdiagram.helper.NodeConstraintHelper(),
			new NodeInstanceSpecificationHelper(),

			// edges factory
			new com.cea.papyrus.diagram.classdiagram.helper.EdgeDependencyHelper(),
			new EdgeGeneralizationHelper(),
			new EdgeAssociationHelper(),
			new EdgeConnectorHelper(),
			new EdgeRealizationHelper(),
			new EdgeUsageHelper(),
			new EdgeInterfaceRealizationHelper(),
			new com.cea.papyrus.diagram.classdiagram.helper.EdgeGraphLinkHelper(),
			new EdgeRoleBindingHelper(),
			new EdgeAbstractionHelper()
//			new EdgeInstanceSpecificationHelper()			
	};

	public ComponentDiagramModelerHelper() {
		// The ComponentDiagramModelerHelper inherits from the ClassDiagramModelerHelper
		// We remove the component helper from the class diagram  
		// to use the component helper from component diagram
		//creationFactoryMap.remove(org.eclipse.uml2.uml.Component.class);
		// CreateFactories
		for(int i=0; i<elementTypes.length; i++){
			creationFactoryMap.put( elementTypes[i], nodeFactory[i]);
		}		
	}

	public static ComponentDiagramModelerHelper getInstance() {
		if (EINSTANCE == null) {
			EINSTANCE = new ComponentDiagramModelerHelper();
		}
		return EINSTANCE;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.cea.papyrus.common.factories.IModelerFactory#getId()
	 */

	@Override
	public String getId() {
		return IPapyrusUIConstants.COMPONENT_DIAGRAM;
	}	

}
